/**
 * 
 */
package com.lanyou.esb.servicemix.monitor;

import java.io.File;
import java.util.List;

import retrofit.mime.TypedFile;
import retrofit.mime.TypedString;

import com.lanyou.esb.servicemix.bean.Bundle;
import com.lanyou.esb.servicemix.monitor.rest.MonitorService;
import com.lanyou.esb.servicemix.monitor.rest.ProxyService;
import com.lanyou.esb.servicemix.monitor.rest.bean.BundleResponse;
import com.lanyou.esb.servicemix.monitor.rest.bean.Property;

/**
 * @author gonglei
 *
 */
public class TestESBMonitor {

	/**
	 * @param args
	 */
	/*public static void main(String[] args) {
		
		//监控类接口
		MonitorService monitorService=ESBServerFactory.getInstance().getMonitorService("123");
		ProxyService proxyService=ESBServerFactory.getInstance().getProxyService("123");
		BundleResponse bundleResponse=monitorService.getBundles() ;
		List<Bundle> bundles=bundleResponse.getData();
		for (Bundle bundle : bundles) {
			List<Property> property = bundle.getProps();
			System.out.println("isNULL" + property.isEmpty() + property);
		}
//		System.out.print(bundleResponse.getStatus());
//		for (Bundle bundle:bundles) {
//			System.out.println(bundle.getName());
//			testGetBundle(monitorService,bundle.getId());
//		}
		
//		ServiceResponse serviceResponse=monitorService.getServices();
//		System.out.print(serviceResponse.getStatus());
//		FieldSystem system=new FieldSystem();
//		system.setSystemCode("gonglei");
//		FieldSystem system=proxyService.getFieldSystemByCode("test");
//		System.out.println(system.getSystemCode());
		//testInstall(monitorService);
	}*/

	public static void testGetBundle(MonitorService monitorService,int bundleId){
		BundleResponse bundleResponse= monitorService.getBundleById(bundleId);
		System.out.println(	bundleResponse.getStatus());

	}

	public static void testInstall(MonitorService monitorService){
		/*TypedFile file = new TypedFile("application/java-archive", new File("/Users/gonglei/develop/apache-servicemix-6.1.0/cookproxy-1.0-SNAPSHOT.jar"));
			monitorService.installBundle(new TypedString("install"),new TypedString("start"), new TypedString("80") ,file);*/
			
			
			/*TypedFile file = new TypedFile("application/java-archive", new File("D:/Program Files/apache-servicemix-6.1.0/camel-blueprint-1.0.3-SNAPSHOT.jar"));
			monitorService.installBundle(new TypedString("install"),new TypedString("start"), new TypedString("80") ,file);*/
			

	}

}
